<:!:/>

@file c.collections.html
@author Alejandro Dario Simi
@date $Date: 2013-06-17 01:40:31 +0000 (Mon, 17 Jun 2013) $

$Id: c.collections.html 75 2013-06-17 01:40:31Z daemonraco@gmail.com $
$URL: http://wcomix.googlecode.com/svn/tags/wcomix-1.0-BETA2/themes/default/templates/contents/c.collections.html $

<::/><script type="text/javascript">
<:INCLUDE:padding=1:/>BP-SCRIPT<::/>
	function CreateCollection() {
		if($("#CollectionsFormAction").val()!="REMOVE") {
			var	name = $("#NewCollectionName").val().trim();
			if(name.length > 0) {
				jQuery.post('service.php?action=<:VAR:/>WC_SERVICE_COLLECTIONS<::/>&group=<:VAR:/>GROUP-ID<::/>&create', {
							'NAME':	$("#NewCollectionName").val().trim()
						}, function(data){
					var	xml = $($.parseXML(data));
					if(xml.find("wc-success").length) {
						window.location.href = "?action=<:VAR:/>WC_ACTION_COLLECTION_SHOW<::/>&group=<:VAR:/>GROUP-ID<::/>&collection=" + xml.find("wc-result>collection>id").text();
					} else if(xml.find("wc-failed").length) {
						var	error = "";
						if(xml.find("wc-error>wc-code").length) {
							error = "[" + xml.find("wc-error>wc-code").text() + "] ";
						}
						error = error + xml.find("wc-error>wc-message").text();

						alert("Failed: " + error);
					}
				});
			} else {
				$("#NewCollectionName").focus();
				alert("You must enter a collection name");
			}

			return false;
		} else {
			return true;
		}
	}
</script>

<:ISSET:var=COLLECTIONS-CREATE:/><form id="CollectionsForm" class="Formulary" action="#" onsubmit="return CreateCollection();" method="get">
	<input type="hidden" id="CollectionsFormAction" name="ACTION" value=""/>
	<input type="hidden" id="CollectionsFormId"     name="ID"     value=""/>
	<table><tr>
		<td class="Title" colspan="2"><span class="Title">Create a new collection</span></td>
	</tr><tr>
		<td class="Label">Name</td><td class="Value">
			<input class="Full" type="text" id="NewCollectionName" value=""/>
		</td>
	</tr><tr>
		<td colspan="2" class="Buttons">
			<input type="submit" value="Create Collection"/>
		</td>
	</tr></table>
</form><::/>

<table class="GeneralView"><:OVER:list=COLLECTIONS-LISTS:/><tr>
	<td class="Title">
		<hr/>
		<span class="Prefix"><:VAR:/>prefix<::/></span>
	</td>
</tr><tr>
	<td class="ItemsPool">
		<:OVER:list=list:/>
<:INCLUDE:padding=3:/>/generics/bundlepreview.html<::/>
		<::/>
	</td>
</tr><::/></table>

<:INCLUDE:padding=0:/>/generics/pager.html<::/>
